<?php
session_start();
include_once( 'config.php' );
include_once( 'weibooauth.php' );
include_once('pcode.php');


$c = new SaeTClient( WB_AKEY , WB_SKEY , $_SESSION['last_key']['oauth_token'] , $_SESSION['last_key']['oauth_token_secret']  );
$ms  = $c->home_timeline(); // done
$me = $c->verify_credentials();

?>
<?php
$msg = $c->show_user($me['name']);
if ($msg === false || $msg === null){
	echo "Error occured";
	return false;
}
if (isset($msg['error_code']) && isset($msg['error'])){
	echo ('Error_code: '.$msg['error_code'].';  Error: '.$msg['error'] );
	return false;
}
$imgurl=str_replace("/50/","/180/",$msg['profile_image_url']);
$province=ProvinceCode($msg['province']);

if( isset($_REQUEST['pic'])||isset($_REQUEST['text'] ) ){

$rr = $c ->upload( $_REQUEST['text'] , $_REQUEST['pic'] );

}
if(isset($_REQUEST['uid']))
{
	$rr=$c->follow($_REQUEST['uid']);
	
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>QR传情</title>
<link href="./css/style_similar.css" rel="stylesheet" type="text/css">
<!--[if IE]>
<link href="./css/style_similar_ie.css" rel="stylesheet" type="text/css">
<![endif]-->
<link href="./css/button.css" rel="stylesheet" type="text/css">
<script type="text/javascript" async="" src="./js/ga.js"></script><script language="JavaScript" type="text/javascript" src="./js/jquery.js"></script>
<script language="JavaScript" type="text/javascript" src="./js/corner.js"></script>
<script type="text/javascript" src="./js/counter.js"></script>
</head>
<script language="JavaScript" type="text/javascript">
$(document).ready(function() {
	
	$('#left').corner();
	$('#right').corner();
	$('#result').corner();
	$("#button2").mousedown(function(){
		sendMsg();
	});
	
	
	$('#load').ajaxStart(function() {
		$(this).show();
	});
	$('#load').ajaxComplete(function() {
		$(this).hide();
	});
	if ($.browser.msie) {
		if ($.browser.version == '6.0') {
			$('#ie6').show();
		} else {
			$('#ie6').show();
		}
	}
});
function sendMsg() 
{
	

$.post("./test.php", {text:"我用QR传情生成的QR码情书哦。大家也来试试吧~",pic:$('#imgqr').attr('src')},
   function(data){
  
   				if($('#follow').attr('checked') == true) {
   					follow();
   				}
   				alert('发布成功');
   				window.location = "http://weibo.com";
   				return;
   			} 
                          
   );}
 
function follow() {
	$.post("./test.php", {uid: "1280329601"},
   function(data){
  
   			} 
                          
   );
   }
	
 

 var googleapihead = "http://chart.googleapis.com/chart?cht=qr&chs=300&choe=UTF-8&chld=L|4&chl="
 var chl ="http://icherry.sinaapp.com";

 

 var defaulturl = googleapihead + chl;

 

 function GetURL(){

	var url = googleapihead + encodeURI(document.formAction.content.value);

	

	return url;

 }

 

 function CreateQR(){
if(document.formAction.content.value!=""){
	var url = GetURL();

	document.imgqr.src = url;
	document.getElementById( "msg" ).innerHTML="<br><br>&nbsp;你的QR码情书:";

}
else alert("请输入你的内容!");

}


</script>



</head>
<body>
<div id="ie6">
	<div>IE6的小盆友…，为了你的上网体验，赶快换浏览器吧！&gt;&gt;<a href="http://www.google.com/chrome" target="_blank">最棒的Chrome</a></div>
</div>
<div id="header">
	<div id="load">Loading...</div>
</div>
<div id="contain">
	<div id="left" >
		<div id="user">
			<div id="avatar">
				<a href="http://weibo.com/<?php echo $msg['domain']; ?>" target="_blank">
					<?php echo "<img src=\"".$imgurl."\">"; ?>
				</a>
			</div>
			<div id="info">
				<p><a href="http://weibo.com/<?php echo $msg['domain']; ?>" target="_blank"><?php echo $msg['name']; ?></a></p>
				<p><a href="http://weibo.com/<?php echo $msg['domain']; ?>" target="_blank">http://weibo.com/<?php echo $msg['domain']; ?></a></p>
				<p><?php echo $province; ?></p>
				<p>暂无信息</p>
			</div>
		</div>
		

		<div id="words">
			
			<h2>QR传情</h2>
			
			<div id="result">
								在这写下你想说的...<span id="counter">150</span>
								<form name="formAction">
							

							<textarea name="content" cols="28" rows="11" id="in"></textarea>

						
					</form>
					<br>
						<div align="center" id="button"> <a class="large button red" id="button1" onclick="CreateQR()">点击生成QR码情书</a></div>
						</div>
							
		
		</div>
	</div>
	<div id="middle" >
	<p id="msg">
		<br><br>&nbsp;本应用地址QR码
		</p>
				<div id="img">

							<img name="imgqr" id="imgqr" src="https://chart.googleapis.com/chart?cht=qr&chs=300&choe=UTF-8&chld=L|4&chl=http://icherry.sinaapp.com">

						
			<div id="control">
				关注作者 <a href="http://weibo.com/webpig" target="_blank">@潇翔竹</a>&nbsp;<input id="follow" type="checkbox" value="1">
					<a id="button2"><img src="./img/share_button_l.gif"></a>
			
			</div>
							
							</div>
</div>
	
	<div id="right" >
		<div id="about">
			<h2>关于本应用</h2>
			<div>
				<p style="text-align:center;">
					<img src="./img/logo.png">
				</p>
				<p>QR码属于矩阵式二维码中的一个种类，由DENSO(日本电装)公司开发，由JIS和ISO将其标准化。QR传情，就是采用QR二维码编码你想说的情话，用最科技最时尚的方式对她说我爱你，快来看看吧~</p>
			</div>
		</div>
		<div id="links">
			<h2><a href="https://www.weibo.com/webpig" target="_blank">作者的微博</a></h2>
			<h2>推荐应用：<h2>
			<h2><a href="http://philosopher.sinaapp.com/" target="_blank">我是哪种围脖控</a></h2>
			<h2><a href="https://server.xpat.cc/weibo.php?m=mentions" target="_blank">我提到最多的朋友</a></h2>
		</div>
	</div>
</div>

</body></html>

<?php

$c->end_session();




?>